<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<#include "/common/resources.ftl"/>
<script type="text/javascript">
	$(function(){
		window.m_datagrid = $('#m_datagrid').datagrid({
			url:'${ctx}/qfbao/loancommision/list',
			onLoadSuccess:yixun.closeProgress,
			onBeforeLoad:yixun.progress,
			queryParams:$('#load_list_search').serializeObject(),
			loadMsg:null,
			singleSelect:true,
			fitColumns:true,
			rownumbers:true,
			pagination:true,
			border:'false',
			toolbar:'#m_toolbar'
		});
	
		//按条件查询用户
		window.searchData = function () {
			m_datagrid.datagrid('load',$('#load_list_search').serializeObject());
		}
		
		//删除
		window.deleteDate = function(mid){
			$.messager.confirm('确认!','你确定要删除此数据吗?',function(res){
				if(res){
					$.post("${ctx}/qfbao/loancommision/del",{'id':mid},function(result){
						if (result.errorMsg){
							$.messager.show({
								title: '友情提示',
								msg: 'result.errorMsg'
							});
							m_datagrid.datagrid('reload');
						} else {
							$.messager.show({
								title: '友情提示',
								msg: '删除成功'
							});
						}
					},'json');
				}
			});
		}
		
		//确认
		window.queryDate = function(mid){
			$.messager.confirm('确认!','是否确认?',function(res){
				if(res){
					$.post("${ctx}/qfbao/loancommision/queryData",{'id':mid},function(result){
						window.location.href='shouldShou?orderId='+${model.orderId};
						if (result.errorMsg){
							$.messager.show({
								title: '友情提示',
								msg: 'result.errorMsg'
							});
							m_datagrid.datagrid('reload');
						} else {
							$.messager.show({
								title: '友情提示',
								msg: '确认收款成功'
							});
						}
					},'json');
				}
			});
		}
	});
	mShowButton = function (value,row,index){
		var btns = [];
	
		if(row.status=='已打款'){
			btns.push('<button class="green_btn" onclick="javascript:queryDate('+value+');void(0);">确认收款</button>');
		}
		return btns.join('');
	}
</script>
</head>
<body style="background-color:white;">

<div id="m_toolbar" class="datagrid-toolbar" style="overflow: hidden;height: auto;margin: 15px 0px;background-color: white;border-bottom: none;" border="false">
  <form id="load_list_search" onsubmit="return false;">
  <div class="fm_sty" style="margin: 20px 0px 0px;">
   	<div class="ipt_line">
	<span class="ipt_title">未收：${weiShou}</span>
	<input type="hidden" id="orderId" name="orderId" value="<#if model?exists >${model.orderId}</#if>"></input>
	<input type="hidden" id="payeeId" name="payeeId" value="<#if payeeId?exists >${payeeId}</#if>"></input>
	</div>
   	<div class="ipt_line">
	<span class="ipt_title">应收：${yingShou}</span>
	</div>
   	<div class="ipt_line">
	<span class="ipt_title">实收：${shiShou}</span>
	</div>
	<!--<div class="ipt_line_long">
        <button class="red_100" onclick="javascript:window.location.href='view?orderId=${model.orderId}&id=${model.id}';void(0)">添加应收</button>
	</div> -->   
  </div>
  </form>
</div>

<!-- 查找结果 -->
<table style="margin:0px 20px;" id="m_datagrid">
	<thead>
		<tr>
			<th field="orderId" width="60" height="40" >订单ID</th>
			<th field="amount" width="60" height="40" >金额</th>
			<th data-options="field:'status',formatter:function(value,row,index){var key = 'funds_status';return yixun.combobox_formatter(value,row,index,key);}" width="60" height="40" >状态</th>
			<th field="typeCN" width="60" height="40" >款类</th>
			<th field="payeeName" width="60" height="40" >收款人</th>
			<th field="confirmTime" width="80" height="40" >确认打款时间</th>
            <th field="paymentDate" width="80" height="40" >确认收款时间</th>
			<th data-options="field:'id',formatter:mShowButton,align:'center'" width="150">操作</th>
		</tr>
	</thead>
</table>

</body>
</html>
